import request from '@/utils/request'
import qs from 'qs'

/**
 * 获取列表
 * @param limit
 * @param offset
 */
export function page(limit, offset, name, menuKey) {
  return request({
    url: '/system/basePrivilege/getPage',
    method: 'post',
    data: qs.stringify({
      limit,
      offset,
      name,
      menuKey
    })
  })
}

/**
 * 获取详情
 * @param id
 */
export function getInfo(id) {
  return request({
    url: '/system/basePrivilege/getInfo',
    method: 'post',
    data: qs.stringify({
      id
    })
  })
}

/**
 * 删除
 * @param id
 */
export function delInfo(id) {
  return request({
    url: '/system/basePrivilege/del',
    method: 'post',
    data: qs.stringify({
      id
    })
  })
}

/**
 * 获取上级权限
 * @param limit
 * @param offset
 */
export function superiorList() {
  return request({
    url: '/system/basePrivilege/superiorList',
    method: 'post'
  })
}

export function addOrEdit(id, name, menuKey, pId, type) {
  return request({
    url: '/system/basePrivilege/addOrEdit',
    method: 'post',
    data: qs.stringify({
      id, name, menuKey, pId, type
    })
  })
}

export function getSettingInfo() {
  return request({
    url: '/system/baseSetting/getInfo',
    method: 'post'
  })
}

export function getSettingEditInfo(advertisingFeeNum, costsNum) {
  return request({
    url: '/system/baseSetting/editInfo',
    method: 'post',
    data: qs.stringify({
      advertisingFeeNum, costsNum
    })
  })
}
